﻿using System;
using System.Collections.Generic;
using Microsoft.Office.PowerPoint.STAMP.Common;
using Microsoft.Office.PowerPoint.STAMP.Core;

namespace Microsoft.Office.PowerPoint.STAMP.Command
{
    public class EditorCommand :ICommand
    {
        private readonly ClosedCaptionsList _captionsList;
        private readonly List<string> _validationErrors;

        public EditorCommand()
        {
            _captionsList = ClosedCaptionsList.Empty;
            _validationErrors = new List<string>();
        }

        public EditorCommand(ClosedCaptionsList captions)
        {
            Argument.CheckIfNull(captions, "captions");

            _captionsList = captions;
            _validationErrors = new List<string>();
        }
        public EditorCommand(ClosedCaptionsList captions, List<string> validationErrors)
        {
            Argument.CheckIfNull(captions, "captions");
            Argument.CheckIfNull(validationErrors, "validationErrors");

            _captionsList = captions;
            _validationErrors = validationErrors;
        }

        public void Execute()
        {
            using (var form = new CaptionEditor(_captionsList, _validationErrors))
            {
                form.ShowDialog();
            }
        }
    }
}